#pragma once
#pragma warning(disable:4996)       // disable checked iterator errors http://msdn.microsoft.com/en-us/library/aa985965(VS.80).aspx 

//
// Copyright (C) 2011 Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.101

#include <Macros.h>
#include <CoVector.h>
#include <CoMatrix.h>
#include <CoCube.h>
#include <ValueHelpers.h>
#include <Settings.h>

#include <gen/QL/Math/Integrals/Integrator.h>
#pragma unmanaged 
#include <ql\math\integrals\kronrodintegral.hpp>
#include <boost/smart_ptr/detail/spinlock.hpp>
#pragma managed 

using namespace System;
using namespace QuantLib;
using namespace Cephei;

#undef HANDLE
#undef ABSTRACT
#undef STRUCT
namespace Cephei { namespace QL { namespace Math { namespace Integrals {
	//////////////////////////////////////////////////////////////////////////////////////////////
	// implementation of IGaussKronrodNonAdaptive
	public ref class CGaussKronrodNonAdaptive : 
            public CIntegrator,
            public Cephei::QL::Math::Integrals::IGaussKronrodNonAdaptive
	{
	protected: 
		boost::shared_ptr<QuantLib::GaussKronrodNonAdaptive>* _ppGaussKronrodNonAdaptive;
#ifdef HANDLE
		QuantLib::Handle<QuantLib::GaussKronrodNonAdaptive>* _phGaussKronrodNonAdaptive;
#endif
		Object^ _GaussKronrodNonAdaptiveOwner;     // reference to object that manages the storage for this object
	internal:
		CGaussKronrodNonAdaptive (Double absoluteAccuracy, UInt64 maxEvaluations, Double relativeAccuracy);
        CGaussKronrodNonAdaptive (boost::shared_ptr<QuantLib::GaussKronrodNonAdaptive>& childNative, Object^ owner);
        CGaussKronrodNonAdaptive (QuantLib::GaussKronrodNonAdaptive& childNative, Object^ owner);
        CGaussKronrodNonAdaptive (CGaussKronrodNonAdaptive^ copy);
        CGaussKronrodNonAdaptive (System::Type^ t);
#ifdef STRUCT
        CGaussKronrodNonAdaptive (QuantLib::GaussKronrodNonAdaptive childNative);
#endif       
#ifdef HANDLE
		CGaussKronrodNonAdaptive (QuantLib::Handle<QuantLib::GaussKronrodNonAdaptive>& childNative, Object^ owner);
		CGaussKronrodNonAdaptive (QuantLib::Handle<QuantLib::GaussKronrodNonAdaptive> childNative);
#endif
		virtual ~CGaussKronrodNonAdaptive ();
		!CGaussKronrodNonAdaptive ();

	internal:
		QuantLib::GaussKronrodNonAdaptive& GetReference ();
		boost::shared_ptr<QuantLib::GaussKronrodNonAdaptive>& GetShared ();
		QuantLib::GaussKronrodNonAdaptive* GetPointer ();
        void SetGaussKronrodNonAdaptive (boost::shared_ptr<QuantLib::GaussKronrodNonAdaptive> native)
        {
            if (_ppGaussKronrodNonAdaptive != NULL)
                delete _ppGaussKronrodNonAdaptive;
            _ppGaussKronrodNonAdaptive = new boost::shared_ptr<QuantLib::GaussKronrodNonAdaptive> (native);
            SetIntegrator (boost::dynamic_pointer_cast<QuantLib::Integrator> (*_ppGaussKronrodNonAdaptive));
        }
#ifdef HANDLE
		QuantLib::Handle<QuantLib::GaussKronrodNonAdaptive>& GetHandle ();
#endif
		virtual bool HasNative () override;
    public:
        property Double RelativeAccuracy 
        {
		    virtual Double get () ;
        }
		virtual Cephei::QL::Math::Integrals::IGaussKronrodNonAdaptive^ SetRelativeAccuracy (Double prm1) ;
    };
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Factory class
	public ref class CGaussKronrodNonAdaptive_Factory : public System::MarshalByRefObject,  public IGaussKronrodNonAdaptive_Factory
	{
	public:
        virtual IGaussKronrodNonAdaptive^ Create (Double absoluteAccuracy, UInt64 maxEvaluations, Double relativeAccuracy);
    };
   
/*Cephei*/ } /*QL*/ } /*Math*/ } /*Integrals */}
